package com.test.sink;

import com.test.entry.Order;
import com.test.service.OrderService;
import org.apache.flink.configuration.Configuration;
import org.apache.flink.streaming.api.functions.sink.RichSinkFunction;

public class OrderSink<IN> extends RichSinkFunction<Order> {

    @Override
    public void open(Configuration parameters) throws Exception {
        super.open(parameters);
    }

    @Override
    public void invoke(Order value, Context context) throws Exception {
        OrderService orderService = new OrderService();
        orderService.insert(value);
    }

    @Override
    public void close() throws Exception {
        super.close();
    }
}
